package com.shop.controller;

import com.github.pagehelper.PageInfo;
import com.shop.base.BaseController;
import com.shop.entity.seckillProducts;
import lombok.RequiredArgsConstructor;
import com.shop.service.seckillProductsService;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/seckillProducts")
public class seckillProductsController extends BaseController {

    private final seckillProductsService seckillProductsService;

    @RequestMapping("/listSeckillProducts")
    public PageInfo<seckillProducts> listSeckillProducts() {
        return seckillProductsService.listSeckillProducts();
    }

    @RequestMapping("/addSeckillProducts")
    public void addSeckillProducts(@ModelAttribute seckillProducts seckillProducts) {
        seckillProductsService.addSeckillProducts(seckillProducts);
    }

    @RequestMapping("/updateSeckillProducts")
    public void updateSeckillProducts(@ModelAttribute seckillProducts seckillProducts) {
        seckillProductsService.updateSeckillProducts(seckillProducts);
    }
}
